<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="content">
    <form action="form_2.php" method="post">
        <input type="text" name="str" />
        <button id="btn">查询</button>
    </form>

</div>

<script>
    document.getElementById('btn').onclick=function(){
        let xmlHttp =new XMLHttpRequest();
        xmlHttp.onreadystatechange =function () {
            if(xmlHttp.readyState ==4 && xmlHttp.status ==200){
                document.getElementById('content').innerHTML=xmlHttp.responseText;
            }
        };
        xmlHttp.open("POST",'form_2.php',true);
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.send();
    }


</script>
</body>
</html>